using System;
using System.Collections.Generic;
using System.IO;

namespace CustomTasks
{
    internal class Validator
    {
        public bool Validate(string inputFile, string outputFile, out List<string> file)
        {
            file = null;

            if (String.IsNullOrEmpty(inputFile.Trim()))
            {
                Console.WriteLine("Parameter inputFile empty");
                return false;
            }

            if (String.IsNullOrEmpty(outputFile.Trim()))
            {
                Console.WriteLine("Parameter outputFile empty");
                return false;
            }
            
            if (!File.Exists(inputFile))
            {
                Console.WriteLine(String.Format("Could not find input file '{0}'", inputFile));
                return false;
            }

            var folder = outputFile.Substring(0, outputFile.LastIndexOf("\\"));
            if (!Directory.Exists(folder))
            {
                Console.WriteLine(String.Format("Could not find output folder '{0}'", folder));
                return false;
            }

            file = new List<string>(File.ReadAllLines(inputFile));
            if (file.Count < 1)
            {
                Console.WriteLine(String.Format("No lines in input file '{0}'", inputFile));
                return false;
            }

            return true;
        }
    }
}